<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <button id="btn">hello</button>
    <div id="dv"></div>
    <script>
        // 需求：点击按钮，改变div多个样式的属性值
        function ChangeStyle(btnId,divId,color) {
            this.btnObj = document.getElementById(btnId);//按钮对象
            this.divObj = document.getElementById(divId);//div对象
            this.color = color;//颜色
        }
        ChangeStyle.prototype.init = function () {
            var that = this;
            this.btnObj.onclick = function () {
                that.divObj.style.backgroundColor = that.color;
                that.divObj.style.width = '200px';
                that.divObj.style.height = '200px';
            }
        }
        var cs = new ChangeStyle('btn','dv','yellow');
        cs.init();
    </script>
</body>
</html>